package cn.dankal.flyaudio.home

import api.UserServiceFactory
import cn.dankal.basiclib.base.fragment.BaseRecyclerViewFragment.PAGE_SIZE
import cn.dankal.basiclib.base.recyclerview.BaseRecyclerViewPresenter
import cn.dankal.basiclib.rx.AbstractStateSubscriber
import cn.dankal.business.pojo.ActivityBean
import cn.dankal.business.pojo.BaseBeanList

class MyActivityPrsenter(private val type: Int?) : BaseRecyclerViewPresenter<ActivityBean>() {
    override fun requestData(pageIndex: String?) {

        UserServiceFactory.applyActivityList(type!!,pageIndex,PAGE_SIZE)
                .subscribe(object : AbstractStateSubscriber<BaseBeanList<ActivityBean>>(view) {
                    override fun onNext(t: BaseBeanList<ActivityBean>) {
                        super.onNext(t)
                        this@MyActivityPrsenter.view.render(t.list)
                    }
                })
    }
}